package cn.sdhuijin.mediaplatform.utils;

import java.util.Calendar;

/**
 * @author sunp@sdhuijin.cn:
 * @version 创建时间：2015年3月24日 下午4:46:19 日期时间操作类
 */
public class DateFormatUtil {

	/**
	 * 返回当前日期，星期，时间 （例如 2015年3月24日 星期二 16:49）
	 * 
	 * @return
	 */
	public static String currentDateAndWeekAndTime() {
		Calendar cale = Calendar.getInstance();
		int year = cale.get(Calendar.YEAR);
		int month = (cale.get(Calendar.MONTH)) + 1;
		int dates = cale.get(Calendar.DATE);
		int hour24 = cale.get(Calendar.HOUR_OF_DAY);
		int minute = cale.get(Calendar.MINUTE);
		int day_of_week = cale.get(Calendar.DAY_OF_WEEK) - 1;
		StringBuffer day_of_week_str = new StringBuffer("星期");
		if (day_of_week == 1) {
			day_of_week_str.append("一");
		} else if (day_of_week == 2) {
			day_of_week_str.append("二");
		} else if (day_of_week == 3) {
			day_of_week_str.append("三");
		} else if (day_of_week == 4) {
			day_of_week_str.append("四");
		} else if (day_of_week == 5) {
			day_of_week_str.append("五");
		} else if (day_of_week == 6) {
			day_of_week_str.append("六");
		} else if (day_of_week == 7) {
			day_of_week_str.append("日");
		}
		String str = year + "年" + month + "月" + dates + "日  "
				+ day_of_week_str.toString() + "  " + String.format("%02d", hour24) + ":"
				+ String.format("%02d", minute);
		return str;
	}

}
